<script>
function checkform(){
	var subject=$('input[name="en_flname"]').val();
	if(trim(subject)==''){
		alert('请填写分类英文名!');
		return false;		
	}
	
	commonEffection.setLoading();
	$('#addBulletinForm').submit();
}
	upload.type='bulletin';
	upload.formid='addBulletinForm';
	upload.setAppend=function(imgurl){
		return '<div style="margin:10px"><a href="'+imgurl+'" target="_blank"><img style="height:100px;width:100px;vertical-align:middle;border:1px #cccccc dashed" src="'+imgurl+'" /></a> 图片说明:<input type="text" name="imgIntro[]" value="" /><input type="hidden" name="imgUrl[]" value="'+imgurl+'" />　<input type="button" value="插入" onclick="commonEffection.InserImg(\''+imgurl+'\');" />　<input type="button" value="删除" onclick="upload.delimg(this);" /></div>';
	}
</script>
<div class="frame_addfactoryDiv">
  <form name="addBulletinForm" id="addBulletinForm" enctype="multipart/form-data"  action="administrator<?=CHOSING_DE?>location<?=CHOSING_DE?>doedit?itemid=<?=$this->oneFenleiArray[0]['flid']?>" method="post">
  <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#c8d9e9">
    <tr>
      <td width="15%" class="ri-bbgg"><span class="red">*</span> 分类英文名：</td>
      <td width="85%" class="le">
          <input type="text" name="en_flname" maxlength="30" size="50" value="<?=$this->oneFenleiArray[0]['en_flname']?>" id="en_flname">
	  </td>
    </tr>
     <tr>
      <td width="15%" class="ri-bbgg"><span class="red">*</span> 分类中文名：</td>
      <td width="85%" class="le">
	  	<input type="text" name="flname" maxlength="30" size="50" value="<?=$this->oneFenleiArray[0]['flname']?>" id="flname">
	  </td>
    </tr>
    <tr>
      <td colspan="2" class="se" align="center">
        <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#c8d9e9">
		<tr>
		  <td colspan="7" class="se" style="text-align:left">
		  <strong>可以选的快递公司</strong>
		  </td>
		</tr>
                <tr>
		  <td colspan="7" class="se" style="text-align:left">
<script type="text/javascript">
function move(obj)
{
if(obj=='')
{
return;
}
var oList1=document.getElementById("oListbox1");
var oList2=document.getElementById("oListbox2");
var arrOptions=new Array;
if(obj=="add")
{
if(oList1.options.length<=0)
{
alert("左边已经没有了");
return;
}
if(oList1.selectedIndex<0)
{
alert("请选择要删除的项");
return;
}
for(var i=0;i<oList1.options.length;i++)
{
if(oList1.options[i].selected)
{
//将当前选中的添加到数组中
arrOptions.push(oList1.options[i]);
}
}
for(var i=0;i<arrOptions.length;i++)
{
//循环把数组中的值添加的oList2
oList2.appendChild(arrOptions[i]);
}
}
else if(obj=="delete")
{
if(oList2.options.length<=0)
{
alert("右边已经没有了");
return;
}
if(oList2.selectedIndex<0)
{
alert("请选择要删除的项");
return;
}
for(var i=0;i<oList2.options.length;i++)
{
if(oList2.options[i].selected)
{
arrOptions.push(oList2.options[i]);
}
}
for(var i=0;i<arrOptions.length;i++)
{
oList1.appendChild(arrOptions[i]);
}
}
}
function selectAll()
{
for(var i=0; i< document.getElementById("oListbox2").options.length; i++)
{
 document.getElementById("oListbox2").options[i].selected=true;
}
}
</script>
  <table border="0" class="zhcx" cellpadding="0" cellspacing="0">
    <tr>
      <td><select name="oListbox1" size="18" style="width:320px;" multiple="multiple" id="oListbox1">
          <?for($i=0;$i<count($this->selectyunfeiArray);$i++):?>
          <option value="<?=$this->selectyunfeiArray[$i]['pid']?>"><?=$this->selectyunfeiArray[$i]['carrier']?> -- <?=$this->selectyunfeiArray[$i]['transittime']?>天 -- $<?=$this->selectyunfeiArray[$i]['price']?></option>
          <?endfor;?>
        </select>
      </td>
      <td> &nbsp;<input type="button" class="zhcxbtn" value=" &gt; " onclick="move('add');selectAll();"/>&nbsp;
        <br />
        &nbsp;<input type="button" class="zhcxbtn" value=" &lt; " onclick="move('delete');selectAll();"/> &nbsp;
      </td>
      <td><select name="yunfei[]" size="18" style="width:330px;" multiple="multiple" id="oListbox2">
          <?for($i=0;$i<count($this->yunfeiArray);$i++):?>
          <option value="<?=$this->yunfeiArray[$i]['pid']?>"><?=$this->yunfeiArray[$i]['carrier']?> -- <?=$this->yunfeiArray[$i]['transittime']?>天 -- $<?=$this->yunfeiArray[$i]['price']?></option>
          <?endfor;?>
        </select>
    <script>selectAll();</script>
      </td>
      <td>
      </td>
    </tr>
  </table>
		  </td>
		</tr>
           </table>
      </td>
    </tr>

    <tr>
      <td colspan="2" class="se" align="center">
        <input name="button2" type="button" class="iput" value="保 存"   onclick="checkform();" />　　
        <input name="button" type="button" class="iput" value="返 回" onclick="commonEffection.confirmBack();" />
      </td>
    </tr>
  </table>
</div>
